import request from '@/utils/request'

export function previewContent(query) {
  return request({
    url: '/community/notice/preview_for_web',
    method: 'get',
    params: query
  })
}

// 查询公告详细
export function getContent(noticeId) {
  return request({
    url: '/community/notice/' + noticeId,
    method: 'get'
  })
}

// 新增公告
export function addContent(data) {
  return request({
    url: '/community/notice',
    method: 'post',
    data: data
  })
}

// 修改公告
export function updateContent(data) {
  return request({
    url: '/community/notice',
    method: 'put',
    data: data
  })
}

// 删除公告
export function delContent(noticeId) {
  return request({
    url: '/community/notice/' + noticeId,
    method: 'delete'
  })
}

// 导出公告
export function exportContent(query) {
  return request({
    url: '/community/notice/content/export',
    method: 'get',
    params: query
  })
}

/** 公告板块接口 */
// 查询公告板块列表
export function listSection(query) {
  return request({
    url: '/community/notice/section/list',
    method: 'get',
    params: query
  })
}
// 新增公告板块
export function addSection(data) {
  return request({
    url: '/community/notice/section',
    method: 'post',
    data: data
  })
}
// 删除公告板块
export function delSection(sectionId) {
  return request({
    url: '/community/notice/section/' + sectionId,
    method: 'delete'
  })
}
